﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Caching;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using CRMEntity;

namespace CRMWeb.Utilities
{
    public class UserContext
    {
        private UserContext() {
        }

        public static UserContext Current
        {
            get
            {
                UserContext userContext;
                if (HttpContext.Current.Session["UserContext"] == null)
                {
                    userContext = new UserContext();
                    userContext.CmsMember = null;
                    
                    userContext.IPAddress = HttpContext.Current.Request.UserHostAddress;
                    HttpContext.Current.Session["UserContext"] = userContext;
                }
                userContext = HttpContext.Current.Session["UserContext"] as UserContext;
                return userContext;
            }
            set { HttpContext.Current.Session["UserContext"] = value; }
        }

        public CmsMember CmsMember { get; set; }
        public string ErrorMessage { get; set; }
        public string InfoMessage { get; set; }
        public string IPAddress { get; set; }

    }
}